{% extends "layout.html" %}

{% block title %} Item Detail {% endblock %}

{% block content %}
    <h1>工单详细</h1>

    <hr>
    <h3>创建时间: {{ order_create_time }}</h3>
    <h3>创建人 : {{ order_creator }}</h3>
    <h3>工单编号：{{ order_id }}</h3>
    <h3>工单类型：{{ order_type }}</h3>
    <h3>工单详细：{{ order_comments }}</h3>
    <h3>工单状态：{{ order_status }} </h3>


    <hr>

    <button id="submit" value="提交">提交</button>
{% endblock %}


{% block js %}
    <script>
        $(function () {
            $('#submit').click(function () {
                $.ajax({
                    url: '/admin/action/submit',
                    type: 'GET',
                    data: {
                        action: this.value,
                        orderType: "{{ order_type }}",
                        orderID: "{{ order_id }}",
                        comments: "{{ order_comments }}",
                        creator: "{{ order_creator }}",
                        orderCreateTime: "{{ order_create_time }}"
                    },
                    dataType: 'JSON',
                    success: function (data) {
                        if (data.code == 0) {
                            location.reload()
                        }
                    },
                    error: function (error) {
                        console.log(error)
                    }
                })
            })
        })
    </script>
{% endblock %}


